package wwk.common.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

import android.text.format.DateFormat;

public class DateTimeUtil
{
	public static String getToday()
	{
		Calendar calendar = Calendar.getInstance();
		calendar.setTimeZone(TimeZone.getTimeZone("GMT"));

		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH);
		int day = calendar.get(Calendar.DAY_OF_MONTH);

	    //DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	    //Date date = df.parse(time);

		String today=String.format("%4d-%02d-%02d",year,month+1,day);
		return today;
	}
	
	public static String getNow14()
	{
		Date date=new Date(System.currentTimeMillis()); 
		
		SimpleDateFormat df=new SimpleDateFormat("yyyyMMddHHmmss");
		df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
	    String str = df.format(date);

		return str;
	}
	
	public static String getNow()
	{
		Date date=new Date(System.currentTimeMillis()); 
		
		SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
	    String str = df.format(date);

		return str;
	}
	
	public static String getTimeString(int millionSeconds)
	{
		int seconds=millionSeconds/1000;
		int minitues=seconds/60;
		int hours=minitues/60;
		
		String str=String.format("%02d:%02d:%02d", hours,minitues-hours*60,seconds-minitues*60);
		
		return str;
	}
}
